#pragma once

#include "Singleton.h"
#include "ObjectFactory.h"

class CFileImporter;
class GEOMDBAPI CFileImporterCreator
{
public:
	virtual CFileImporter* Create(void) = 0;
};

//////////////////////////////////////////////////////////////////////////
class GEOMDBAPI CFileImporterFactory
	: public ATools::TSingleton<CFileImporterFactory>,
	public ATools::TObjectFactory<CFileImporter, CString, CFileImporterCreator>
{
public:
	CFileImporterFactory(void);
	~CFileImporterFactory(void);
	void Initialize(void);
	CFileImporter* Create(const CString& szId);
};

inline CFileImporterFactory& GetFileImporterFactory()
{
	return CFileImporterFactory::Instance();
}

//////////////////////////////////////////////////////////////////////////

class GEOMDBAPI CRegFileImporterHelper
{
public:
	CRegFileImporterHelper(const CString& guid, CFileImporterCreator* pEditorCreator);
	~CRegFileImporterHelper();
protected:
	void Register(CFileImporterCreator* pCreator);
	const CString& m_Guid;
};

#define REGISTERE_FileImporter(FileImporter, Id) \
	static CRegFileImporterHelper s_regHelper##Editor(Id,\
	new ATools::TObjectCreator<FileImporter, CFileImporterCreator>());


